package io.renren.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.dao.SupplierDao;

import io.renren.dto.SupplierDTO;
import io.renren.entity.SupplierEntity;
import io.renren.service.SupplierService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 供应商表
 *
 * @author 翟文闯 619556390@QQ.com
 * @since 1.0.0 2019-11-22
 */
@Service
public class SupplierServiceImpl extends CrudServiceImpl<SupplierDao, SupplierEntity, SupplierDTO> implements SupplierService {

    @Autowired
    private  SupplierDao supplierDao;
    @Override
    public QueryWrapper<SupplierEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");

        QueryWrapper<SupplierEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(id), "id", id);

        return wrapper;
    }


    @Override
    public SupplierDTO getSupplier(long id) {

        return  supplierDao.getSupplier(id);
    }
}